Base for all image data classes. More...
Public Member Functions | |
ImageBase () | |
ImageBase (unsigned int width, unsigned int height, PIXEL_FORMAT format) | |
ImageBase (unsigned int width, unsigned int height, unsigned int depth, PIXEL_FORMAT format, unsigned int pixelByteSize, unsigned int rowByteSize) | |
ImageBase (const ImageBase &other) | |
ImageBase (ImageBase &&other) | |
virtual | ~ImageBase () |
unsigned int | getWidth () const |
unsigned int | getHeight () const |
unsigned int | getDepth () const |
PIXEL_FORMAT | getFormat () const |
unsigned int | getPixelByteSize () const |
unsigned int | getRowByteSize () const |
unsigned int | getSliceByteSize () const |
void | setWidth (unsigned int value) |
void | setHeight (unsigned int value) |
void | setDepth (unsigned int value) |
void | setFormat (PIXEL_FORMAT value) |
void | setPixelByteSize (unsigned int value) |
void | setRowByteSize (unsigned int value) |
void | setSliceByteSize (unsigned int value) |
nkMaths::Vector | getPixel (unsigned int x, unsigned int y, unsigned int z=1) |
virtual unsigned char * | getDataPtr () const =0 |
ImageBase & | operator= (const ImageBase &other) |
ImageBase & | operator= (ImageBase &&other) |
Base for all image data classes.
An image holds informations such as the data of the image, its size, alignment in memory... It also offers utilities to access a particular pixel data.
This class family is also the basis for all exchanges in the component. Where data ownership is in play, Image is used. Where no data ownership is needed, ImageView is used.
nkImages::ImageBase::ImageBase | ( | ) |
Default constructor.
nkImages::ImageBase::ImageBase | ( | unsigned int | width, |
unsigned int | height, | ||
PIXEL_FORMAT | format | ||
) |
Simple 2D constructor.
width | The width of the image, in pixels. |
height | The height of the image, in pixels. |
format | The pixel format of the image. |
nkImages::ImageBase::ImageBase | ( | unsigned int | width, |
unsigned int | height, | ||
unsigned int | depth, | ||
PIXEL_FORMAT | format, | ||
unsigned int | pixelByteSize, | ||
unsigned int | rowByteSize | ||
) |
Full constructor.
width | The width of the image, in pixels. |
height | The height of the image, in pixels. |
depth | The depth of the image, in number of slices of width * height images. |
format | The pixel format of the image. |
pixelByteSize | The size of a pixel, in bytes. |
rowByteSize | The size of a row, in bytes. |
nkImages::ImageBase::ImageBase | ( | const ImageBase & | other | ) |
Copy constructor.
other | The base to copy over. |
nkImages::ImageBase::ImageBase | ( | ImageBase && | other | ) |
Move constructor.
other | The base to move over. |
|
virtual |
Destructor.
unsigned int nkImages::ImageBase::getWidth | ( | ) | const |
unsigned int nkImages::ImageBase::getHeight | ( | ) | const |
unsigned int nkImages::ImageBase::getDepth | ( | ) | const |
PIXEL_FORMAT nkImages::ImageBase::getFormat | ( | ) | const |
unsigned int nkImages::ImageBase::getPixelByteSize | ( | ) | const |
unsigned int nkImages::ImageBase::getRowByteSize | ( | ) | const |
unsigned int nkImages::ImageBase::getSliceByteSize | ( | ) | const |
void nkImages::ImageBase::setWidth | ( | unsigned int | value | ) |
Sets the width of the image.
value | The width to assign, in pixels. |
void nkImages::ImageBase::setHeight | ( | unsigned int | value | ) |
Sets the height of the image.
value | The height to assign, in pixels. |
void nkImages::ImageBase::setDepth | ( | unsigned int | value | ) |
Sets the depth of the image.
value | The depth to assign, in number of slices of width * height images. |
void nkImages::ImageBase::setFormat | ( | PIXEL_FORMAT | value | ) |
Sets the pixel format.
value | The pixel format image is using. |
void nkImages::ImageBase::setPixelByteSize | ( | unsigned int | value | ) |
Sets the size of a pixel.
value | The size to assign, in bytes. |
void nkImages::ImageBase::setRowByteSize | ( | unsigned int | value | ) |
Sets the size of a row of the image.
value | The size to assign, in bytes. |
void nkImages::ImageBase::setSliceByteSize | ( | unsigned int | value | ) |
Sets the size of the depth slices.
value | The size to assign, in number of slices of width * height images. |
nkMaths::Vector nkImages::ImageBase::getPixel | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned int | z = 1 |
||
) |
Allows to retrieve a pixel at given coordinates. This function abstracts the memory access required to reach given pixel (alignment, sizes...).
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
z | The z coordinate of the pixel, if the texture has a depth. |
|
pure virtual |
Implemented by the sub-classes which know about how the memory is given.
Implemented in nkImages::ImageView, and nkImages::Image.
Copy assignment operator.
other | The base to copy and assign. |
Move assignment operator.
other | The base to move and assign. |